<?
namespace D3hdv\HdvBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class HdvCoffreVenteObjetDiablo3Form extends AbstractType
{
    private $objetId;

    public function __construct($objetId)
    {
        $this->objetId = $objetId;
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {        
	$idObjet=$this->objetId;
	
	$builder->add('Objet','entity', array(
	            		'class' => 'D3hdvDiablo3Bundle:D3Objet',
	            		'property' => 'ObjetModele.nom',
			        'query_builder' => function (\D3hdv\Diablo3Bundle\Entity\D3ObjetRepository $repository) use ($idObjet)
			     {
			         return $repository->createQueryBuilder('d')
			                ->where('d.id = ?1')
			                ->setParameter(1,$idObjet);
			             
			     }
			));
	$builder->add('Prix', 'integer');

	/*$builder->add('public', 'checkbox', array(
    'label'     => 'Me prevenir si mon prix est jugé correct par le systeme ?',
    'required'  => false,
));*/
    }
    
    public function getName()
    {        
        return 'hdvcoffreventeobjetdiablo3';
    }
}

?>
